package com.sc.nft.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

@AllArgsConstructor
@Getter
public enum IncomeTypeEnum {

    DIRECT_PURCHASE(1, "藏品购买", 1),
    DIRECT_PURCHASE_FEE(2, "寄售手续费", 1),
    IP_MALL_DIRECT_PURCHASE(3, "IP商城-直推收益", 1),
    INTERIM_PURCHASE(21, "藏品购买", 2),
    INTERIM_PURCHASE_FEE(22, "寄售手续费", 2),
    IP_MALL_INTERIM_PURCHASE(23, "IP商城-间推收益", 2),
    NURTURING_AWARD(30, "培育奖", 3),//培育奖销售总额
    NURTURING_AWARD_PURCHASE(31, "培育奖-销售金额", 3),//培育奖销售总额
    NURTURING_AWARD_PURCHASE_FEE(32, "培育奖-手续费", 3),//培育奖寄售手续费
    TEAM_CONTRIBUTION_AWARD_PURCHASE(33, "团队贡献奖-销售金额", 3),//团队贡献奖销售总额
    TEAM_CONTRIBUTION_AWARD_PURCHASE_FEE(34, "团队贡献奖-手续费", 3),//团队贡献奖寄售手续费
    TEAM_CONTRIBUTION_AWARD(35, "团队贡献奖", 3),
    CITY_SERVER(36, "服务中心分润", 3),
    COMMUNITY_DIVIDEND(37, "社区网点分润", 3),
    POSITION_REWARD(38, "持仓奖", 3),
    PLATFORM_MARKET_VALUE_INCOME(40, "平台市值收益", 3),
    PLATFORM_PROFIT(41, "平台利润收益", 3),
    CITY_SERVER_CENTRE(42, "城市寄售分润", 3),// ip分润也使用这个
    CITY_SERVER_SALES(43, "城市首发分润", 3),
    CITY_IP_SERVER_SALES(44, "IP业务分润", 3),
    URBAN_EXTENSION_DIVIDEND(45, "城市服务中心推广分润", 3),
    IP_MALL_CITY_SERVER_CENTER(46, "IP商城-城市服务中心收益", 3),
    COMMUNITY_INITIAL_DIVIDEND(47, "社区首发分润", 3),
    COMMUNITY_SECONDARY_DIVIDEND(48, "社区二级分润", 3),
    IP_MALL_NETWORK_REVENUE(49, "IP商城网点收益", 3),
    COPYRIGHT_INCOME(50, "版权收益", 3),
    SUPPLY_CHAIN(51, "供应商推荐收益", 3),
    NONO_INCOME(52, "IP商城-闹闹商城收益", 3),
    META_INCOME(53, "IP商城-玛特收益", 3),
    META_INCOME_DIVIDE(54, "IP商城-玛特收益-全民瓜分", 4),
    META_INCOME_RANKING_LIST(55, "IP商城-玛特收益-排行榜", 4),
    ECOLOGICAL_COMMODITY_INCOME_BUY(56, "IP商城-生态商品收益-购买人网体", 4),
    ECOLOGICAL_COMMODITY_INCOME_PLATFORM(57, "IP商城-生态商品收益-平台", 4),
    DISTRIBUTION_COMMISSION(58, "分销佣金", 1),
    PROPS_SHARE(59, "道具分红", 1),
    ORDER_GAS_SHARE(60, "上链费分红", 3),


    ;

    @EnumValue
    private int code;

    private String description;

    private int incomeHierarchyType;

    public static IncomeTypeEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (IncomeTypeEnum v : values()) {
            if (v.code == id) {
                return v;
            }
        }
        return null;
    }

    public static List<IncomeTypeEnum> isDaoIncome() {
        List<IncomeTypeEnum> list = Lists.newArrayList();
        //IP商城-闹闹商城收益
        list.add(NONO_INCOME);
        //IP商城-玛特收益
        list.add(META_INCOME);
        //IP商城-生态商品收益-购买人网体
        list.add(ECOLOGICAL_COMMODITY_INCOME_BUY);
        //IP商城-生态商品收益
        list.add(ECOLOGICAL_COMMODITY_INCOME_PLATFORM);
        return list;
    }
}
